﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Threading.Tasks;

namespace Simple.CMS.Web.Principal
{
    public class AdminPrincipal: IPrincipal
    { 
        public IIdentity Identity { get; set; }

        public bool IsInRole(string role)
        {
            if (Identity.IsAuthenticated)
            {
                var identity = Identity as AdminIdentity;
                if (identity != null)
                {
                    return identity.Roles.Contains(role);
                }
            }
            return false;
        }
    }
}
